from transformers import BertTokenizer, BertModel

# 设置模型文件所在的本地路径
model_name = "C:/Users/86182/Desktop/sqsx_lqbz/model_download"

# 加载分词器和模型
tokenizer = BertTokenizer.from_pretrained(model_name)
model = BertModel.from_pretrained(model_name)

# 定义输入文本
input_text = "Hello, how are you?"

# 对输入文本进行分词编码
inputs = tokenizer(input_text, return_tensors="pt")

# 使用模型生成输出
outputs = model(**inputs)

# 打印输出的 last_hidden_state
print(outputs.last_hidden_state)
